package org;

public class T {
/**
 * 		$titleLength=12;
		echo '<table width="100%" border="1"><tr>';
		$index=0;
		foreach ($this->data as $article){
			if ($index<=3){
				echo '<td align="center" width="25%"><a href="'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'" title="'.$article['Title'].'" target="_blank">
									  <img class="pic1" src="'.$article['DefaultPicUrl'].'" border="0" height="90" width="110">
									  </a><br><a href="'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'">'.Utils::replaceHtmlAndJs($article['Title'],12).'</a></td>';
				if ($index==3){
					echo '</tr>';
				}
			}
			if ($index>3){
				if ($index==4){
					echo ' <tr> <td colspan="4"><table width="100%" border="0"><tr><td colspan="3"></td></tr><tr>';
				}
				if (($index-3)%3==0){

					echo '<td align="left"><li><a href="'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'">'.Utils::replaceHtmlAndJs($article['Title'],22).'</a></li></td></tr><tr>';
				}else{
					if($index==count($this->data)){
					if (($index-3)%3!=0){
						echo '<td colspan="'.((3-($index-3)%3)+1).'">'.'<li><a href="'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'">'.Utils::replaceHtmlAndJs($article['Title'],22).'</a></li>'.'</td>';
					}
					
				}else{
					echo '<td align="left"><li><a href="'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'">'.Utils::replaceHtmlAndJs($article['Title'],22).'</a></li></td>';
				}
				}
			}
			
			$index++;
		}
			echo '</tr></table>';
 */
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int i=11;
		System.out.println("<table width=\"100%\" border=\"1\"><tr>");
		for(int j=0;j<i;j++){
			if(j<=3)
				System.out.println("<td align=\"center\" width=\"25%\"><a href=\"'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'\" title=\"'.$article['Title'].'\" target=\"_blank\">"+
									  "<img class=\"pic1\" src=\"'.$article['DefaultPicUrl'].'\" border=\"0\" height=\"90\" width=\"110\">"+
									  "</a><br><a href=\"'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'\">'.Utils::replaceHtmlAndJs($article['Title'],12).'</a></td>");
			if(j==3)
			System.out.println("</tr>");
			if(j>3){
				if(j==4)
					System.out.println("<tr> <td colspan=\"4\"><table width=\"100%\" border=\"0\"><tr><td colspan=\"3\"></td></tr><tr>");
				//System.out.println("("+j+"-3)%3="+((j-3)%3)+"\n");
				if((j-3)%3==0){
					System.out.println("<td align=\"left\"><li><a href=\"'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'\">'.Utils::replaceHtmlAndJs($article['Title'],22).'</a></li></td></tr>");
			if(j!=(i-1))
				System.out.println("<tr>");
				}else{
					if(j==(i-1)){
						if((i-3)%3!=0)
							System.out.println("<td colspan=\"'.((3-($index-3)%3)+1).'\">'.'<li><a href=\"'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'\">'.Utils::replaceHtmlAndJs($article['Title'],22).'</a></li>'.'</td></tr>");
					}else{
						System.out.println("<td align=\"left\"><li><a href=\"'.Yii::app()->request->baseUrl.'?r=article/detail&id='.$article['ArticleID'].'\">'.Utils::replaceHtmlAndJs($article['Title'],22).'</a></li></td>");
					}
				}
			}
		}
		System.out.println("</table>");

	}

}
